/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.AgendaDAO;
import model.PacienteDAO;

/**
 *
 * @author Eduarda
 */
public class TratapreCadastroCompromisso extends Comando{

    @Override
    public void executar(HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, SQLException, IOException, ServletException {
        
         
    response.setContentType("text/html;charset=UTF-8");

        PacienteDAO pacdao = new PacienteDAO();
        AgendaDAO agendao = new AgendaDAO();
        HttpSession session = request.getSession(false);
        session.setAttribute("listaPacientes", pacdao.pesquisar());
        session.setAttribute("listaAgendas", agendao.pesquisar());
       //session.setAttribute("listaPacientes", new ArrayList());        
        response.sendRedirect("cadastraCompromisso.jsp");
        
        
    }
    
}
